package com.newbee.viewpager;

import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;

public class RegViewPager extends ViewPager
{

	private boolean isCanScroll = false;

	public RegViewPager(Context context)
	{
		super(context);
	}

	public RegViewPager(Context context, AttributeSet attrs)
	{
		super(context, attrs);
	}

	public void setScanScroll(boolean isCanScroll)
	{
		this.isCanScroll = isCanScroll;
	}

	@Override
	public boolean onTouchEvent(MotionEvent ev)
	{
		if (isCanScroll == false)
		{
			return false;
		}
		else
		{
			return super.onTouchEvent(ev);
		}

	}

	@Override
	public boolean onInterceptTouchEvent(MotionEvent ev)
	{
		if (isCanScroll == false)
		{
			return false;
		}
		else
		{
			return super.onInterceptTouchEvent(ev);
		}

	}

	public boolean isCanScroll()
	{
		return isCanScroll;
	}

	public void setCanScroll(boolean isCanScroll)
	{
		this.isCanScroll = isCanScroll;
	}

}
